<?php
	
	require 'database.php';
			
	if($_POST['kies'])
	{
		$checkbox = $_POST['checkbox']; 
		$countCheck = count($_POST['checkbox']);
		
		
		for($i=0;$i<$countCheck;$i++)
		{
			$add_id  = $checkbox[$i];			
			
			$sql = "INSERT INTO verzendmethode_klant(Id, methode, klantnr) VALUES('".$add_id."',(SELECT methode FROM verzendmethode WHERE id = ".$add_id."), '2')" ;
			$result = $mysqli->query($sql) or die(mysqli_error($mysqli));						
			
		}
			if($result)
		{	
				header('Location: klant_bezorg.php');
			}
			else
			{
				echo "Error: ".mysql_error();
			}
	}
?>